import { createRouter, createWebHashHistory } from "vue-router";
import LayOut from '@/Layout/index.vue'


const routes = [
  {
    path: "/",
    name: "layout",
    component: LayOut,
    children: [
      {
        path: '/',
        redirect: '/dashBoard'
      },
      {
        path: '/dashBoard',
        name: '首页',
        meta: {
          menus: []
        },
        component: () => import('../views/DashBoard/index.vue')
      },
      {
        path: '/cateList',
        name: '文章管理',
        meta: {
          menus: [{
            name: '系统管理',
            path: '/cateList'
          }]
        },
        component: () => import('../views/CateList/index.vue')
      },
      {
        path: '/cartlist',
        name: '轮播图管理',
        meta: {
          menus: [{
            name: '系统管理',
            path: '/cateList'
          }]
        },
        component: () => import('../views/CartList/index.vue')
      },
      {
        path: '/goods',
        name: '商品管理',
        meta: {
          menus: [{
            name: '商品管理',
            path: '/goods'
          }]
        },
        component: () => import('../views/GoodsList/index.vue')
      },
      {
        path: '/wangcontent',
        name: '文章详情修改',
        meta: {
          menus: [{
            name: '系统管理',
            path: '/cateList'
          },{
            name: '文章管理',
            path: '/cateList'
          }]
        },
        component: () => import('../views/WangContent/index.vue')
      },
      {
        path: '/userlist',
        name: '用户管理',
        meta: {
          menus: []
        },
        component: () => import('../views/UserList/index.vue')
      },
      {
        path: '/orderlist',
        name: '订单管理',
        meta: {
          menus: []
        },
        component: () => import('../views/OrderList/index.vue')
      },
      {
        path: '/calendar',
        name: '日历',
        meta: {
          menus: []
        },
        component: () => import('../views/Calendar/index.vue')
      },
      {
        path: '/music',
        name: '网抑云音乐',
        meta: {
          menus: []
        },
        component: () => import('../views/Music/index.vue')
      },
      {
        path: '/addmusic',
        name: '添加音乐',
        meta: {
          menus: [{
            name: '网抑云',
            path: '/music'
          }]
        },
        component: () => import('../views/AddMusic/index.vue')
      },


      {
        path: '/setting',
        name: '设置',
        meta: {
          menus: []
        },
        component: () => import('../views/Setting/index.vue')
      },
      {
        path: '/userInfo',
        meta: {
          menus: []
        },
        name: '个人中心',
        component: () => import('../views/UserInfo/index.vue')
      },
    ]
  },
  {
    path: "/login",
    name: "login",
    component: () =>
      import('@/views/LoginPage'),
  },
  {
    path: "/:pathMatch(.*)*",
    name: "notfound",
    component: () => import('@/views/NotFound')
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
